<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 
1.一个重要的内置关系：VueCompenent.prototype.__proto__===Vue.prototype
2.为了让组件实例对象(vc)可以访问到Vue原型上的属性、方法
     -->
</head>
p
<body>
    <div id="root">
       <school></school>
    </div>
    <script src="../vue.js"></script>
    <!-- <script>
        //定义一个构造函数
        function Demo()
        {
            this.a=1
            this.b=2
        }
        //创建一个Demo的实例对象
        const d=new Demo()
        console.log(Demo.prototype);  //显式原型属性
        console.log(d.__proto__);  //隐式原型属性
        console.log(Demo.prototype===d.__proto__);

        //程序员通过显示原型属性操作原型对象，追加一个x属性 值为99
         Demo.prototype.x=99
        console.log(d.__proto__.x); 
    </script> -->
    <script>
        Vue.prototype.x=99
        const school = Vue.extend({
            template: `
            <div>
                <h2>{{name}}</h2>
                <h2>{{address}}</h2>
                <button @click='showx'>点我输出</button>
                </div>`,
            data() {
                return {
                    name: '清华大学',
                    address: '北京'
                }
            },
            methods:
            {
                showx()
                {
                    console.log(this.x);
                }
            }
        })
        const vm = new Vue({
            el: '#root',
            data: {
                msg:'你好'
            },
            components:{
                school
            }
        })

        console.log(school.prototype.__proto__===Vue.prototype);
    </script>
</body>

</html>